<?php
$server = "localhost";
$username = "root";
$password = "";

$conn = new mysqli ( $server, $username, $password );
$result = mysqli_query ( $conn, "create database account_db" );
echo "<p>创建数据库：";
var_dump ( $result );
$result = mysqli_query ( $conn, "use account_db" );
echo "<p>选择数据库：";
var_dump ( $result );
$result = mysqli_query ( $conn, "set names utf8" );
echo "<p>设置数据库编码：";
var_dump ( $result );
$result = mysqli_query ( $conn, "create table account(id int auto_increment primary key, username varchar(50) not null, password varchar(50) not null, email  varchar(50) not null)" );
echo "<p>创建表：";
var_dump ( $result );
$result = mysqli_query ( $conn, "insert into account(username, password, email) values ('Jack', '123456', 'liuyi@example.com')" );
echo "<p>插入数据：";
var_dump ( $result );
mysqli_close ( $conn );
?>
